#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QDebug>
#include <QHash>
#include <QListWidgetItem>
#include <QGraphicsObject>
#include <QQuickView>
#include <QQuickItem>
#include <QFile>
#include <QLabel>
#include <QMessageBox>

#include <QtWebKitWidgets/QWebView>
#include <QtWebKitWidgets/QWebPage>
#include <QtWebKitWidgets/QWebFrame>

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

#include "Constants.h"
#include "botserver.h"
#include "geoscript.h"
#include "videothread.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

public:
    void UpdateSensors(SensorParser* sensorData);
    void geoscriptClick(void);
    void addVideo();
    GeoScript *geoObject;


public slots:
    void setNewMsg(QString Msg);
    void controlHandler(QString direct);
    void UpdateVideo(QImage newImage);

private:
    Ui::MainWindow *ui;
    QString *latestMsg;
    ConfigParser* configuration;
    SensorParser* sensorData;
    AckParser* acknowledgment;
    QListWidgetItem* itmBot;
    QListWidgetItem* itmVideo;
    BotServer botServer;

    //Controller Components from DPad.qml
    QQuickView* controller;
    QQuickItem* dPad;

    //Video Processing
    QList<int>* videoThreadIDs;
    QLabel* newVideo;
    cv::VideoCapture* cvCamera;
    cv::Mat* matOriginal;
    cv::Mat* matProcessed;
    QImage* qimgOriginal;
    QImage* qimgProcessed;
    VideoThread* vidThread;

};

#endif // MAINWINDOW_H
